package io.israel.ephraim;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.common.impl.persistence.StrongUuidGenerator;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author imlij
 */
@Slf4j
@SpringBootApplication
public class IsraelEphraimApplication {

	public static void main(String[] args) {
		SpringApplication.run(IsraelEphraimApplication.class, args);
	}

	/**
	 * @param strongUuidGenerator 流程引擎ID生成器
	 * @return
	 */
	@Bean
	public EngineConfigurationConfigurer<SpringProcessEngineConfiguration> processEngineConfigurationConfigurer(
			StrongUuidGenerator strongUuidGenerator
	) {
		return engineConfiguration -> {
			engineConfiguration.setIdGenerator(strongUuidGenerator);
		};
	}

	/**
	 * @return
	 */
	@Bean
	public StrongUuidGenerator strongUuidGenerator() {
		return new StrongUuidGenerator();
	}
}
